Developer Documentation

QuickTime 4 API Documentation

3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next |

Cylinders

Figure 17 shows a cylinder.

Figure 17 A cylinder

Labels

ASCII
Cylinder
Binary
cyln ( = 0x63796C6E )

Data Format

Vector3D            orientation
Vector3D            majorRadius
Vector3D            minorRadius
Point3D             origin
Float32             uMin
Float32             uMax
Float32             vMin
Float32             vMax
orientation
The orientation of the cylinder.
majorRadius
The major radius of the cylinder.
minorRadius
The minor radius of the cylinder.
origin
The origin (that is, the center of the base) of the cylinder.
uMin
Minimum parametric limit value for u. To understand u, first consider u for the ellipse determined by majorRadius and minorRadius . The value of u on this ellipse is parametrized by the angle between the major axis and the vector from the origin to the circumference of the ellipse. The value u = 0 corresponds to 0 radians, and u = 1 corresponds to 2 radians. The values uMin and uMax are used to create partial ellipses. The basic idea is that only the part of the ellipse between uMin and uMax is drawn. For such a particular partial ellipse, the partial cylinder can be thought of as the result of keeping uMin and uMax fixed but letting v vary through its admissible range. The result looks like a cylinder with a wedge taken out. For details, see the QD3D documentation or develop magazine, Dec. 96. Must be 0 in Version 1.5.
uMax
Maximum parametric limit value in u direction; see uMin above. Must be 1 in Version 1.5.
vMin
Minimum parametric limit value in v direction. The value of v can be viewed as arc length parametrization of the orientation vector, ranging from 0 at the origin to 1 at the tip. If vMin is not 0, then a cylinder-shaped slice will be removed from the bottom of the cylinder. Must be 0 in Version 1.5.
vMax
Maximum parametric limit value in v direction; see vMin above. Must be 1 in Version 1.5.

Data Size

0 or 64

Description

A cylinder is a three-dimensional object defined by an origin (that is, the center of the cylinder) and three mutually perpendicular vectors that define the orientation and the major and minor radii of the cylinder. A cylinder may include a top cap, a bottom cap, or both. Attributes may be assigned to each included cap, to the face of the cylinder, and to the entire cylinder.

Default Surface Parameterization

The default surface parameterization for a cylinder is as shown in Figure 17 .

Parent Hierarchy

Shared, shape, geometry.

Parent Objects

None.

Child Objects

Caps (top), top cap attribute set, caps (bottom), bottom cap attribute set, face cap attribute set, attribute set. All child objects are optional.

Example

Cylinder ( )

Cylinder (
    0 2 0
    0 1 0
    0 0 1
    0 0 0
    0       # uMin
    1       # uMax
    0       # vMin
    1       # vMax
)
Container (
    Cylinder ( )
    Caps ( Bottom | Top )
    Container (
        BottomCapAttributeSet ( )
        Container (
        AttributeSet ( )
        DiffuseColor ( 0 1 0 )
        )
    )
    Container (
        FaceCapAttributeSet ( )
        Container (
            AttributeSet ( )
            DiffuseColor ( 1 0 1 )
        )
    )
    Container (
        TopCapAttributeSet ( )
        Container (
            AttributeSet ( )
            DiffuseColor ( 1 1 0 )
        )
    )
)

In the above example, color attributes are attached to the surface of the cylinder very indirectly. As you see, color objects are elements of ordinary attribute sets rather than of cap attribute sets. Those attribute sets are elements of containers, which, in turn, are elements of cap attribute sets. The cap attribute sets serve to bind the ordinary attribute sets to the caps of the cylinder.

Default size

For objects of size 0, the default is:

1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 1


© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next |